/*package dao;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.criterion.Example;


public class ObjectOperations<T> extends DaoFactory {

	private T dataObject;

	public ObjectOperations(HttpServletRequest request, T dataObject) {
		super(request);
		this.dataObject = dataObject;
	}

	public ObjectOperations(HttpServletRequest request) {
		super(request);
	}

	public void save() {
		try {
			tx = session.beginTransaction();
			session.save(dataObject);
			session.getTransaction().commit();
		} catch (Exception e) {
			if (tx != null)
				tx.rollback();
			e.printStackTrace();
		}
		closing();
	}
	
	public void update() {
        try {
            tx = session.beginTransaction();
            session.update(dataObject);
            session.getTransaction().commit();
        } catch (Exception e) {
            if (tx != null)
                tx.rollback();
            e.printStackTrace();
        }
        closing();
    }
	

	// ask with sql or hql --------------------------------------------------------------------
	// querries-------------------------------------------------------------------------------
	@SuppressWarnings("unchecked")
	public List ask(String queryName, String... params) {

		
		List<T> list=null;
		try {
			tx = session.beginTransaction();
			Query query = session.getNamedQuery(queryName);

			int i = 0;
			for (String param : params)
				query.setString(i++, param);
			session.getTransaction().commit();
			list=(List<T>)query.list();
			
		} catch (Exception e) {
			rollingBack();
			e.printStackTrace();
		}
		closing();

		return list;

	}

	
	
	// ask example queries
	// ----------------------------------------------------------------------------------------------------------------

	public List askExample(Example example, Class<T> class1) {
		
		List<T> list=null;
		try {
			tx = session.beginTransaction();
			Criteria criteria = session.createCriteria(class1).add(example);
			list=(List<T>)criteria.list();
			session.getTransaction().commit();

			
		} catch (Exception e) {
			rollingBack();
			System.out.println(" ******************************* unknown error     ************************************") ;
			e.printStackTrace();
		}
		closing();
		
		return list;
	}
	
	public T getbyId(long id, Class<T> class1)
    {
	    T entite=null;
        try
        {
            tx = session.beginTransaction();
            entite=(T) session.get( class1, id );
            session.getTransaction().commit();
        }
        catch (Exception e)
        {
            rollingBack();
            System.out.println(" ******************************* unknown error     ************************************") ;
            e.printStackTrace();
        }
        closing();
        return entite;
        
    }
	
	
	


}
*/